package esport

import (
	"gorm.io/gorm/clause"
	"longmen/server/config/global"
	"longmen/server/pkg/db/mysql/models/models_sports"
)

func CreateMatchTempSchedule(records []*models_sports.MatchTempSchedule) {
	clauses := clause.OnConflict{
		UpdateAll: true,
	}
	global.Sport().Clauses(clauses).CreateInBatches(records, 100)
}

func DeleteMatchTempSchedule(ids []int) {
	schedule := models_sports.MatchTempSchedule{}
	err := global.Sport().Model(&schedule).Where("match_id in (?) ", ids).Delete(&schedule).Error
	if err != nil {
		return
	}
}
